package com.yanmaohu.yulia.bean;

/**
 * @author Bright Lee
 */
public final class GroupingColumnReference implements OrdinaryGroupingSet {

    private int beginIndex;
    private int endIndex;
    private ColumnReference columnReference;
    private CollateClause collateClause;

    public GroupingColumnReference(ColumnReference columnReference,
                                   CollateClause collateClause) {
        this.beginIndex = columnReference.getBeginIndex();
        this.endIndex = collateClause != null ? collateClause.getEndIndex() : columnReference.getEndIndex();
        this.columnReference = columnReference;
        this.collateClause = collateClause;
    }

    @Override
    public int getBeginIndex() {
        return beginIndex;
    }

    @Override
    public int getEndIndex() {
        return endIndex;
    }

    public ColumnReference getColumnReference() {
        return columnReference;
    }

    public CollateClause getCollateClause() {
        return collateClause;
    }

}
